from sanic import Blueprint
from sanic.response import text

import redis

sanic_bp = Blueprint('s_bp')


@sanic_bp.route('/redis')
async def my_redis(request):
    pool = redis.ConnectionPool()
    r = redis.Redis(connection_pool=pool)

    pipe = r.pipeline()

    r.set('name', 'suu')
    r.set('name', 'yu')
    pipe.execute()
    print(r.get('name'))

    return text('success!')
